package com.yjd.pub.project.dao.impl;

import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.comm.project.model.ProjectModel;
import com.yjd.comm.project.model.ProjectShowInfo;
import com.yjd.comm.util.FrameUtil;
import com.yjd.pub.project.dao.IProjectDao;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <b>description</b>：项目数据访问层 <br>
 * <b>time</b>：2017-06-27 08:55:08 <br>
 * <b>author</b>： yangchangyan@yijiedai.com
 */
@Component("projectDao")
public class ProjectDaoImpl extends BaseDaoImpl implements IProjectDao {

	private static final String SQLMAPNAMESPACE = ProjectModel.class.getName();
	private static final String PKNAME = "project_id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}


	/**
	 * 搜索多个项目 根据idlist(项目id)
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	@Override
	public List<ProjectShowInfo> getProjectInfoList(List<Long> list) throws Exception {
		return (List<ProjectShowInfo>) this.getSqlMap(false).queryForList(getStatement("getProjectListByKeys"), FrameUtil.newHashMap("idList",list));
	}
}
